#region

using System;
using System.Collections.Generic;
using System.Linq;
using InfoTech.VinhSon.Bussiness;

#endregion

namespace InfoTech.VinhSon.Repository
{
    public partial class UserRepository
    {
        #region IUserRepository Members

        public bool CheckInsertUser(User user)
        {
            return !DbSet.Any(c => (c.Inactive == false || c.Inactive == null) && (c.Username.Equals(user.Username,
                                                                                                    StringComparison.CurrentCultureIgnoreCase) || c.Email.Equals(user.Email,
                                                                                                                                                                 StringComparison.CurrentCultureIgnoreCase)));
        }

        public bool CheckUpdateUser(User user)
        {
            return !DbSet.Any(c => c.Id != user.Id && (c.Inactive == false || c.Inactive == null) && (c.Username.Equals(user.Username,
                                                                                                    StringComparison.CurrentCultureIgnoreCase) || c.Email.Equals(user.Email,
                                                                                                                                                                 StringComparison.CurrentCultureIgnoreCase)));
        }

        public bool CheckDeleteUser(IEnumerable<int> value)
        {
            return true;
        }

        #endregion
    }
}
